package com.enlorenz.core.channel.socket.imp.shortconnection;

import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;

import com.enlorenz.core.channel.IChannelEngine;
import com.enlorenz.core.channel.socket.common.server.AbstractServerChannel;

/**
 * 标准Socket通信，短连接
 * 服务端
 * 一收一发
 * @author lcb
 */
public class NioSocketServerChannel extends AbstractServerChannel implements IChannelEngine{

	@Override
	protected void doAfterRead(SelectionKey key) {
		//读取之后退出事件，等待队列的写事件
		key.cancel();
	}

	@Override
	protected void doAfterWrite(SelectionKey key) {
		key.cancel();
		SocketChannel sc=(SocketChannel)key.channel();
		closeSocketChannel(sc,new RuntimeException("doAfterWrite"));
	}
	
}
